//强制取消请求
//定义state
export type HttpState = {
  httpList: any[]
}
export const state: HttpState = {
  httpList:[]
}
//定义mutations
export const mutations = {
  // 设置
  setHttpList(state, payload) {
    if (payload == 0) {
      //强行中断时才向下执行
      state.httpList.forEach(item => {
        item("interrupt"); //给个标志，中断请求
      });
      state.httpList = [];
    } else {
      state.httpList.push(payload);
    }
  },
}
//定义getters
export const getters = {
  getLoad(state: HttpState) {
    return state.httpList
  },
}
//定义actios
export const actions = {
  async getHttpList(ctx) {
    ctx.commit("setHttpList", 0);
  },
}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}